﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinqToBing.Bing.Wrapper.Enums;

namespace LinqToBing.Bing.Wrapper
{
    /// <summary>
    /// Contains the single sources to search whithin, including related informations
    /// </summary>
    public class SearchTypeContainer
    {
        public SearchSource SearchSource { get; set; }
        public int? Offset { get; set; }
        public int? Count { get; set; }

        /// <summary>
        /// Factory Method.
        /// </summary>
        /// <param name="searchType">Specifies search type</param>
        /// <param name="offset">result offset (default is 0 or null)</param>
        /// <param name="count">number of required results (can be omitted)</param>
        /// <returns>Returns an instance of SearchTypeContainer</returns>
        public static SearchTypeContainer CreateContainer(SearchSource searchType, int? offset, int? count)
        {
            return new SearchTypeContainer(searchType, offset, count);
        }
       
        /// <summary>
        /// Factory Method.
        /// </summary>
        /// <param name="searchType">Specifies search type</param>
        /// <returns>Returns an instance of SearchTypeContainer</returns>
        public static SearchTypeContainer CreateContainer(SearchSource searchType)
        {
            return new SearchTypeContainer(searchType, null, null);
        }

        /// <summary>
        /// Factory Method.
        /// </summary>
        /// <param name="searchType">Specifies search type</param>
        /// <returns>Returns an instance of SearchTypeContainer</returns>
        public static SearchTypeContainer CreateContainer()
        {
            return new SearchTypeContainer(SearchSource.Web, null, null);
        }        
        
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="searchSource"></param>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        private SearchTypeContainer(SearchSource searchSource, int? offset, int? count)
        {
            SearchSource = searchSource;
            Offset = offset;
            Count = count;
        }

    }
}
